// src/api/student.js
import apiClient from './index'

export const studentApi = {
    // 个人信息
    registerStudent(studentData) {
        return apiClient.post('/students/register', studentData)
    },

    getStudentProfile() {
        return apiClient.get('/students/profile')
    },

    updateStudentProfile(studentData) {
        return apiClient.put('/students/profile', studentData)
    },

    // 实习申请
    submitApplication(applicationData) {
        return apiClient.post('/internship-applications', applicationData)
    },

    getStudentInternships(studentId) {
        return apiClient.get(`/internships/student-info/${studentId}`)
    },

    getMyApplications(params) {
        return apiClient.get('/internship-applications/my', { params })
    },

    getApplicationDetail(applicationId) {
        return apiClient.get(`/internship-applications/${applicationId}`)
    },

    cancelApplication(applicationId) {
        return apiClient.put(`/internship-applications/${applicationId}/cancel`)
    },

    // 实习材料相关API
    getMyMaterials() {
        return apiClient.get('/internship-materials/my')
    },

    submitMaterial(materialData) {
        return apiClient.post('/internship-materials', materialData)
    },

    getMaterialDetail(materialId) {
        return apiClient.get(`/internship-materials/${materialId}`)
    },

    updateMaterial(materialId, materialData) {
        return apiClient.put(`/internship-materials/${materialId}`, materialData)
    },

    deleteMaterial(materialId) {
        return apiClient.delete(`/internship-materials/${materialId}`)
    },

    // 成绩查看
    getMyEvaluations() {
        return apiClient.get('/evaluations/my')
    },

    // 获取我的实习信息（新添加的方法）
    getMyInternships() {
        return apiClient.get('/internships/my')
    },

    // 获取实习最终成绩评定（新添加的方法）
    getFinalEvaluation(internshipId) {
        return apiClient.get(`/student/internships/${internshipId}/final-evaluations`)
    }
}
